/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "BookTables", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "BookTables.findAll", query = "SELECT b FROM BookTables b"),
    @NamedQuery(name = "BookTables.findReportBookTable", query = "SELECT b FROM BookTables b WHERE b.orderDate >= :fromdate AND b.orderDate<= :todate"),
    @NamedQuery(name = "BookTables.findByBookTableID", query = "SELECT b FROM BookTables b WHERE b.bookTableID = :bookTableID"),
    @NamedQuery(name = "BookTables.findByBookTableByUser", query = "SELECT b FROM BookTables b WHERE b.customers.custID = :custID"),
    @NamedQuery(name = "BookTables.findByNoSeats", query = "SELECT b FROM BookTables b WHERE b.noSeats = :noSeats"),
    @NamedQuery(name = "BookTables.findByOrderDate", query = "SELECT b FROM BookTables b WHERE b.orderDate = :orderDate"),
    @NamedQuery(name = "BookTables.findByReserveFee", query = "SELECT b FROM BookTables b WHERE b.reserveFee = :reserveFee"),
    @NamedQuery(name = "BookTables.findByStatus", query = "SELECT b FROM BookTables b WHERE b.status = :status")})
public class BookTables implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Basic(optional = false)
    @Column(name = "BookTableID", nullable = false)
    private Integer bookTableID;
    @Basic(optional = false)
    @Column(name = "NoSeats", nullable = false)
    private int noSeats;
    @Basic(optional = false)
    @Column(name = "OrderDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date orderDate;
    @Basic(optional = false)
    @Column(name = "ReserveFee", nullable = false, precision = 19, scale = 4)
    private BigDecimal reserveFee;
    @Basic(optional = false)
    @Column(name = "Status", nullable = false)
    private boolean status;
    @JoinColumn(name = "ResID", referencedColumnName = "ResID", nullable = false)
    @ManyToOne(optional = false)
    private Restaurants restaurants;
    @JoinColumn(name = "CustID", referencedColumnName = "CustID", nullable = false)
    @ManyToOne(optional = false)
    private Customers customers;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bookTables")
    private List<BookTableDetails> bookTableDetailsList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "bookTables")
    private List<CancelTableBooking> cancelTableBookingList;

    public BookTables() {
    }

    public BookTables(Integer bookTableID) {
        this.bookTableID = bookTableID;
    }

    public BookTables(Integer bookTableID, int noSeats, Date orderDate, BigDecimal reserveFee, boolean status) {
        this.bookTableID = bookTableID;
        this.noSeats = noSeats;
        this.orderDate = orderDate;
        this.reserveFee = reserveFee;
        this.status = status;
    }

    public BookTables(int noSeats, Date orderDate, BigDecimal reserveFee) {
        this.noSeats = noSeats;
        this.orderDate = orderDate;
        this.reserveFee = reserveFee;
    }

    public Integer getBookTableID() {
        return bookTableID;
    }

    public void setBookTableID(Integer bookTableID) {
        this.bookTableID = bookTableID;
    }

    public int getNoSeats() {
        return noSeats;
    }

    public void setNoSeats(int noSeats) {
        this.noSeats = noSeats;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public BigDecimal getReserveFee() {
        return reserveFee;
    }

    public void setReserveFee(BigDecimal reserveFee) {
        this.reserveFee = reserveFee;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public Restaurants getRestaurants() {
        return restaurants;
    }

    public void setRestaurants(Restaurants restaurants) {
        this.restaurants = restaurants;
    }

    public Customers getCustomers() {
        return customers;
    }

    public void setCustomers(Customers customers) {
        this.customers = customers;
    }

    public List<BookTableDetails> getBookTableDetailsList() {
        return bookTableDetailsList;
    }

    public void setBookTableDetailsList(List<BookTableDetails> bookTableDetailsList) {
        this.bookTableDetailsList = bookTableDetailsList;
    }

    public List<CancelTableBooking> getCancelTableBookingList() {
        return cancelTableBookingList;
    }

    public void setCancelTableBookingList(List<CancelTableBooking> cancelTableBookingList) {
        this.cancelTableBookingList = cancelTableBookingList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bookTableID != null ? bookTableID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BookTables)) {
            return false;
        }
        BookTables other = (BookTables) object;
        if ((this.bookTableID == null && other.bookTableID != null) || (this.bookTableID != null && !this.bookTableID.equals(other.bookTableID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.BookTables[bookTableID=" + bookTableID + "]";
    }
}
